<?php
//mail('hasankhatib91@gmail.com', 'haha subject', 'resala :D');

include_once('config.php');
//if (isset($_POST['title'])) {
    $title = $_POST['title'];
    $desc = $_POST['desc'];
    $price = $_POST['price'];
    $discount = $_POST['discount'];
    $category = $_POST['category'];
    $file = $_POST['myfile'];

    $date = date('y-m-d');
    
    $alloweTypes = array("jpg", "png", "gif", "jpeg");

    $extensions = explode(".", $_FILES ['myfile']["name"]);
    $extension = $extensions[count($extensions) - 1];
    $newName = time() . "." . $extension;
    if (move_uploaded_file($_FILES['myfile']['tmp_name'], "../images/products/" . $newName)) {
        
    } else {
        
    }
    mysql_query("insert into product (title,descreption,image,date,price,productCategory,discount,active)
    				VALUES ('$title','$desc','$newName','$date','$price','$category','$discount',1) ");
    echo 'success';
//mysql_query($sql);
//    mysql_close($con);
//}else{
    
//}
?>